﻿$(document).ready(function () {
    initializeFields();
    $("#timePickerStart").change(function () {
        startTimeUpdated();
    });
    $("#timePickerEnd").change(function () {
        endTimeUpdated();
    });
    $("#datePickerDay").change(function () {
        startTimeUpdated();
        endTimeUpdated();
    });
});

function initializeFields() {
    $("#StartTime").hide();
    $("#EndTime").hide();
    $('#timePickerStart').timepicker({});
    $('#timePickerEnd').timepicker({});
    startTimeUpdated();
    endTimeUpdated();
}

function startTimeUpdated() {
    var startTime = $("#timePickerStart").val();
    var date = $("#datePickerDay").val();
    $("#StartTime").val(date + " " + startTime);
}

function endTimeUpdated() {
    var endTime = $("#timePickerEnd").val();
    var date = $("#datePickerDay").val();
    $("#EndTime").val(date + " " + endTime);
}